import {get, post, postForm} from "../util/http"
import {AddScheduleParam, JobScheduleNameVO, JobScheduleVO, UpdateScheduleParam} from "../model/Schedule";

export default {
    queryAllSchedule(jobCycle: number, currentScheduleId?: string): Promise<Array<JobScheduleNameVO>> {
        return get<Array<JobScheduleNameVO>>("/schedule/queryAllSchedule", {jobCycle, currentScheduleId});
    },
    queryJobSchedule(jobMetaDataId: bigint): Promise<Array<JobScheduleVO>> {
        return postForm<Array<JobScheduleVO>>("/schedule/queryJobSchedule", {jobMetaDataId});
    },
    deleteJobSchedule(id: bigint): Promise<string> {
        return postForm<string>("/schedule/deleteJobSchedule", {id});
    },
    toggleEnable(id: bigint, enable: boolean): Promise<string> {
        return postForm<string>("/schedule/toggleEnable", {id, enable});
    },
    addJobSchedule(data: AddScheduleParam): Promise<string> {
        return post<string>("/schedule/addJobSchedule", data);
    },
    updateJobSchedule(data: UpdateScheduleParam): Promise<string> {
        return post<string>("/schedule/updateJobSchedule", data);
    }
}